package com.design.twords.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.design.twords.R;
import com.design.twords.adatper.HelpsAdapter;
import com.design.twords.entity.ItemHelpTips;
import com.design.twords.utils.MyApplication;

import java.util.ArrayList;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

/**
 * Create by Alen
 * Time:  23:01
 */
public class HelpFragment extends Fragment {

    private static final String TAG ="HelpFragment";
    private RecyclerView helps;
    private HelpsAdapter helpsAdapter;
    private ArrayList<ItemHelpTips> helpTips = new ArrayList<>();

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.item_help, container, false);

    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        MyApplication.getInstance().addActivity(getActivity());
        initView();
        initData();



        helps.setLayoutManager(new LinearLayoutManager(getContext()));
        helpsAdapter = new HelpsAdapter(helpTips, getContext(), R.layout.item_helptips);
        helps.setAdapter(helpsAdapter);

    }

    private void initView() {
        helps = getActivity().findViewById(R.id.help_recycleview);
    }

    private void initData() {
        helpTips.add(new ItemHelpTips("本应用采用的技术支持","百度OCR、有道翻译、bomb云后端"));
        helpTips.add(new ItemHelpTips("拍照识别辨识度","拍照识别来源于百度OCR技术,其辨识度基本在90%以上,如果不能识别出您所要的词,还请手动添加"));
        helpTips.add(new ItemHelpTips("没有想要的单词书","目前处于内测阶段,词书资源有限,如果您有更好的词书资源,欢迎联系作者"));

    }

}
